//package com.caidan.comsumer.config;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.ReturnedMessage;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.BeansException;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @项目名 rabbit-mq-learning
// * @描述
// * @作者 wzy
// * @时间 2024/5/20 16:10
// */
//@Configuration
//@Slf4j
//public class MqConfirmConfig implements ApplicationContextAware {
//    @Override
//    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//        RabbitTemplate rabbitTemplate = applicationContext.getBean(RabbitTemplate.class);
//        rabbitTemplate.setReturnsCallback(new RabbitTemplate.ReturnsCallback() {
//            @Override
//            public void returnedMessage(ReturnedMessage returned) {
//                log.info("收到消息{}",returned.getMessage());
//                log.info("交换机{}",returned.getExchange());
//                log.info("秘钥{}",returned.getRoutingKey());
//                log.info("回复代码{}",returned.getReplyCode());
//                log.info("文本{}",returned.getReplyText());
//            }
//        });
//    }

//}
